package com.dailyblue.java.standard.design.适配器模式;

// 适配器类
public class PhoneAdapter implements PhoneCharge {

    private Power power;

    public PhoneAdapter(Power power) {
        this.power = power;
    }

    @Override
    public int output5v() {
        // 获取到220v的输入电流
        int voltage = power.output();
        System.out.println("输入电流是：" + voltage + "v");
        while (voltage >= 5) {
            System.out.println("手机冲入了5v电流");
            voltage -= 5;
        }
        return 5;
    }
}
